load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "profiler",
    srcs = [
        "activequeryprofiler.go",
        "cgoprofiler.go",
        "cluster_settings.go",
        "cpuprofiler.go",
        "heapprofiler.go",
        "memory_monitoring_profiler.go",
        "profiler_common.go",
        "profilestore.go",
        "statsprofiler.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/server/profiler",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/server/debug",
        "//pkg/server/dumpstore",
        "//pkg/server/status",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/util/cgroups",
        "//pkg/util/envutil",
        "//pkg/util/log",
        "//pkg/util/log/logcrash",
        "//pkg/util/mon",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_dustin_go_humanize//:go-humanize",
    ],
)

go_test(
    name = "profiler_test",
    size = "small",
    srcs = [
        "activequeryprofiler_test.go",
        "cpuprofile_test.go",
        "memory_monitoring_profiler_test.go",
        "profiler_common_test.go",
        "profilestore_test.go",
    ],
    embed = [":profiler"],
    deps = [
        "//pkg/server/dumpstore",
        "//pkg/settings/cluster",
        "//pkg/util/log",
        "//pkg/util/mon",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
    ],
)
